﻿using System.Net.Mail;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;

namespace PortalWeb.Business.Manager
{
    public class EmailService : IIdentityMessageService
    {
        public Task SendAsync(IdentityMessage message)
        {
            MailMessage emilMessage = new MailMessage
            {
                From = new MailAddress("c1945@163.com"),
                Subject = message.Subject,
                Body = message.Body,
                IsBodyHtml = true,
                Priority = MailPriority.High
            };
            emilMessage.To.Add(message.Destination);

            SmtpClient client = new SmtpClient();
            client.SendAsync(emilMessage, null);

            // 在此处插入电子邮件服务可发送电子邮件。
            return Task.FromResult(0);
        }
    }
}
